package com.kfm.am.synchronize;

public class Operator {

    private int number = 1;

    public void add() {
        synchronized (this) {
            for (int i = 0; i < 10000; i++) {
                number++;
            }
        }
    }

    public void sub() {
        synchronized (this) {
            for (int i = 0; i < 10000; i++) {
                number--;
            }
        }
    }

    public int getNumber() {
        return number;
    }
}
